home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / comms / mosiac / mosaic_1.2_as225r2 / contrib / mshunt / mosaic_shunt_nocomments.rexx next >
OS/2 REXX Batch file  |  1978-06-29  |  2KB  |  83 lines

  1. /*Shunt for Amiga Mosaic, (c) 1994 Aaron Weiss*/
  2. savemode=2 
  3. savedrawer='temp:pix'     
  4. jpegviewer='graphics:pfastjpeg %s' 
  5. gifviewer='graphics:vt/vt screenmode="super72:super-high res laced" %s' 
  6. iffviewer='graphics:vt/vt screenmode="super72:super-high res laced" %s' 
  7. animviewer='graphics:vt/vt screenmode="super72:super-high res laced" %s'
  8. playiff='sound:oplay %s'
  9. playau='sound:oplay %s'
  10.  
  11. Infile=ARG(1)
  12. FileName=Infile
  13. filehead=''
  14. if open(.IFile, FileName, 'R') then do
  15.                                  filehead = filehead || (READCH(.IFile,40))
  16.                                  close (FileName)
  17.                                end
  18.          
  19. SELECT
  20.  When INDEX(filehead,"GIF") > 0 then viewer=gifviewer
  21.  When INDEX(filehead,"JFIF") > 0 then viewer=jpegviewer
  22.  When INDEX(filehead,"ILBM") > 0 then viewer=iffviewer
  23.  When INDEX(filehead,"ANIM") > 0 then viewer=animviewer
  24.  When INDEX(filehead,"8SVX") > 0 then viewer=playiff
  25.  When INDEX(filehead,"snd") > 0 then viewer=playau
  26.  OTHERWISE viewer='none'
  27. END
  28.  
  29. filepos=1
  30. DO UNTIL filepos=0 
  31.  filepos=INDEX(viewer,"%s")
  32.  If filepos>0 Then 
  33.   DO
  34.    cmd1=LEFT(viewer,(filepos-1))
  35.    cmd2=RIGHT(viewer,LENGTH(viewer)-(filepos+1))
  36.    viewer=cmd1||Infile||cmd2
  37.   END 
  38. END 
  39.          
  40.       ADDRESS command
  41.       conwindow=">CON:0/0/320/100/Mosaic Shunt Message/Close"
  42.       CALL OPEN out, "t:rexx.tmp",write
  43.       CALL WRITELN out, viewer 
  44.       CALL CLOSE out
  45. if viewer~='none' Then 'execute' "t:rexx.tmp"
  46.                   Else 'echo "Could not identify file type!" >con:0/100/255/20/Shunt_Message/CLOSE/WAIT'
  47.                        
  48. If savemode>1 Then 
  49. DO
  50. SaveFile=Infile
  51. Mark=LASTPOS("/",SaveFile)
  52. If Mark==0 Then 
  53.  Mark=LASTPOS(":",SaveFile)
  54. If Mark>0 Then 
  55.   SaveFile=Right(SaveFile,LENGTH(SaveFile)-Mark)
  56.  
  57. If savemode=2 Then
  58.  DO
  59. 'requestfile DRAWER' savedrawer 'FILE' SaveFile 'TITLE "Save This Baby Where?" > t:savefile'
  60. If rc~=0 Then DO
  61.                'echo "Save cancelled" >con:0/100/250/20/Shunt_Message/CLOSE/WAIT'
  62.                exit
  63.               END  
  64.          ELSE DO
  65. FileName='t:savefile'
  66. SaveFile=''     
  67.       if open(IFile, FileName, 'R') then do
  68.           do until eof(IFile)
  69.             SaveFile = SaveFile || (READLN(IFile))
  70.          end
  71.          end
  72.               END
  73.  END     
  74.  ELSE SaveFile=savedrawer ||'/'||SaveFile        
  75.  
  76. 'copy ' Infile Savefile
  77.     
  78. END
  79. exit
  80.          
  81.  
  82.  
  83.